<template>
  <view>
    <button @click="onCompassChange">onCompassChange</button>
    <button @click="startCompass">startCompass</button>
    <button @click="stopCompass">stopCompass</button>
  </view>
</template>

<script>
export default {
  methods: {
    onCompassChange () {
      uni.onCompassChange(function (event) {
        console.log(event)
      })
    },
    startCompass () {
      uni.startCompass({
        success () {
          console.log('startCompass success')
        },
        fail () {
          console.log('startCompass fail')
        }
      })
    },
    stopCompass () {
      uni.stopCompass({
        success () {
          console.log('stopCompass success')
        },
        fail () {
          console.log('stopCompass fail')
        }
      })
    }
  }
}
</script>

<style>
</style>